package com.heima.aliyun.green.config;

import com.heima.aliyun.green.AliyunGreenTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * AliyunProperties.class 交给IOC容器管理
 */
@EnableConfigurationProperties(AliyunProperties.class)
public class AliyunGreenConfig {

    /**
     * 将ImageGreenScan注入到IOC容器中
     */
    @Bean
    public ImageGreenScan imageGreenScan() {
        return new ImageGreenScan();
    }

    /**
     * 将TextGreenScan注入到IOC容器中
     */
    @Bean
    public TextGreenScan textGreenScan() {
        return new TextGreenScan();
    }

    /**
     * 将AliyunGreenTemplate注入到IOC容器中
     */
    @Bean
    public AliyunGreenTemplate aliyunGreenTemplate(TextGreenScan textGreenScan, ImageGreenScan imageGreenScan) {
        return new AliyunGreenTemplate(imageGreenScan, textGreenScan);
    }
}



